package cn.frank.framework.caesar.module.ai.qwen.rest;

import cn.frank.framework.caesar.module.ai.qwen.conf.logback.AppenderMarkerFilter;
import cn.hutool.core.date.DateUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

/**
 * @description: TODO
 * @author: renjiangyang
 * @date 2024/7/30 15:41:57
 * @since 1.8
 */
@Slf4j
public class BaseQwenRestController {

    /**
     * 公共方法，获取request
     */
    public HttpServletRequest getRequest() {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        return request;
    }

    /**
     * 测试接口
     *
     * @param message
     * @return
     */
    @Operation(summary = "测试")
    @Parameters({
            @Parameter(name = "message",description = "文件id",in = ParameterIn.QUERY)
    })
    @GetMapping(value = "/frank")
    public String mySync(String message) {
        log.info("123");
        log.info(AppenderMarkerFilter.alone, "abc");
        return DateUtil.now() + " success ";
    }

}
